#include "common.h"

#include <string>
#include <map>
#include <memory>

struct TToken;
class LexedFile
    {
    char*           Load(const char* Filename);
    friend class    Lex;
    LexedFile(const char* Filename);
private:
    ~LexedFile();
    LexedFile(const LexedFile& Other);            // disallow: private and no definition
    LexedFile& operator=(const LexedFile& Other); // disallow: private and no definition

    struct Deleter{void operator()(LexedFile*File) const {delete File;}};
    std::string     Filename;               // name of file
    char*           Buffer;                 // complete text of file
    TToken*         Tokens;                 // array of tokens (result of tokenizing Buffer)
    int             ErrorCount;             // # of error tokens in Tokens
    LexedFile*      ParentFile;             // file that caused us to be loaded (or NULL)
    };

class Lex
    {
public:
    Lex();
   ~Lex();
    LexedFile&   FileLoad(const char* Filename);
private:
    std::map<std::string, std::unique_ptr<LexedFile, LexedFile::Deleter>> Files;
    };

#if 0
LexedFile::~LexedFile()
    {
    }


Lex::Lex()
    {
    }
Lex::~Lex()
    {
//    Files.clear();
    }

void main(void)
    {
    Lex   ThisLex;
    }

#endif
